﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace MiniWeb.Web.Controllers
{
    public class BaseController : System.Web.Mvc.Controller
    {
        public string LogOnUser
        {
            get { return User.Identity.IsAuthenticated ? User.Identity.Name : string.Empty; }
        }

        protected ActionResult AlertMsg(string msg, string returnUrl)
        {
            var script = string.Format("<script>alert('{0}');this.location.href='{1}';</script>", msg, returnUrl);
            Response.Write(script);
            Response.End();
            return new EmptyResult();
        }

        protected ActionResult AlertMsgNoR(string msg)
        {
            var script = string.Format("<script>alert('{0}');';</script>", msg);
            Response.Write(script);
            Response.End();
            return new EmptyResult();
        }
    }
}
